<?php

namespace App\Jobs;


use App\Libraries\Easemob\Easemob;
use App\Libraries\Tools\Msg;
use App\Models\HongBao\HongBao;
use App\Models\Msg\MsgSystem;
use Illuminate\Support\Facades\Log;
use JMessage\IM\Friend;
use JMessage\IM\User;
use JMessage\JMessage;

class UpdateIMUser extends Job
{


    private $user;


    public function __construct($user)
    {
        $this->user = $user;
    }

    /**
     * Execute the job.
     *
     * @return bool
     */
    public function handle()
    {
        $client = new JMessage(env('JMSG_APPKEY'), env('JMSG_SECRET'));
        $j_user = new User($client);
        $j_user->update('beboy_'.$this->user->user_id, [
            'nickname' => $this->user->nickname,
            'avatar'   => $this->user->cover
        ]);
        return true;
    }
}
